<template>
  <div class="select-seat">
    <div class="header">
      <van-nav-bar title="电影选座" left-arrow @click-left="back">
      </van-nav-bar>
    </div>
    <div class="container">
      <div class="title">{{ hallName }}</div>
      <div class="seats-box">
        <van-checkbox-group
          v-model="result"
          checked-color="#dd403b"
          icon-size="24px"
        >
          <van-checkbox name="a" shape="square"></van-checkbox>
          <van-checkbox name="b" shape="square"></van-checkbox>
          <van-checkbox name="c" shape="square" disabled></van-checkbox>
          <van-checkbox
            name="d"
            shape="square"
            v-for="(item, index) in 57"
            :key="index"
          >
          </van-checkbox>
        </van-checkbox-group>

        <div class="seats-detail">
          <van-checkbox-group v-model="result" direction="horizontal">
            <van-checkbox name="a">可选</van-checkbox>
            <van-checkbox name="b" disabled class="sell">已售</van-checkbox>
            <van-checkbox name="c" disabled>不可售</van-checkbox>
          </van-checkbox-group>
        </div>
      </div>

      <div class="card-box">
        <div class="tip-box" v-for="(item, index) in noticeData" :key="index">
          <div class="tip-img">
            <img class="auto-img" :src="item.imgUrl" alt="" />
          </div>
          <p class="text one-text">{{ item.detail }}</p>
          <div class="right">
            <span>一个通知</span>
            <van-icon name="arrow-down" />
          </div>
        </div>
        <div class="film-box">
          <div class="filmName">{{ movieName }}</div>
          <div class="filmDetail" :style="{ color: showDetail.dateColor }">
            {{ showDetail.dateDesc }}&nbsp;&nbsp;{{ showDetail.showDate }}&nbsp;
            {{ showDetail.showTime }}-{{ showDetail.endTime }}&nbsp;&nbsp;{{
              showDetail.endTime
            }}
            &nbsp;&nbsp;{{ showDetail.lang }}
          </div>
        </div>
      </div>
    </div>

    <div class="bottom">
      <van-button type="primary" block color="#FF950B" round>
        <span class="price">&yen; 76</span>
        <span>确认选座</span>
      </van-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "SelectSeat",

  data() {
    return {
      result: ["a"],

      // 影厅
      hallName: "",
      activeNames: ["1"],

      noticeData: [],
      movieName: "",
      showDetail: "",
    };
  },

  created() {
    this.getSeatsData();
  },
  methods: {
    back() {
      this.$router.go(-1);
    },

    getSeatsData() {
      this.axios({
        method: "get",
        url: "cinema/seat.json",
      })
        .then((res) => {
          console.log("res=>", res);
          this.hallName = res.data.data.hall.hallName;
          this.noticeData = res.data.data.reminder.notice;
          this.movieName = res.data.data.movie.movieName;
          this.showDetail = res.data.data.relatedShow[0];
          // console.log('this.showDetail=>',this.showDetail);
        })
        .catch((err) => {
          console.log("err=>", err);
        });
    },
  },
};
</script>

<style lang="less" scoped>
.header {
  width: 100%;
  height: 46px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 999;
  background-color: #dd403b;
  /deep/ .van-nav-bar {
    background-color: #dd403b;
  }
  /deep/ .van-hairline--bottom::after {
    content: "";
    width: 0;
    height: 0;
    border-bottom: none;
  }
  /deep/ .van-nav-bar__arrow {
    font-size: 22px;
    color: #fff;
    font-weight: bold;
  }
  /deep/ .van-nav-bar__title {
    color: #fff;
    font-size: 19px;
  }
  /deep/ .van-icon-star {
    margin-right: 10px;
  }
}
.container {
  // border: 1px solid #000;
  margin-top: 47px;
  margin-bottom: 62px;
  // background-color: #f5f5f5;
  .title { 
    text-align: center;
    font-size: 18px;
    padding: 10px 0;
    color: #666;
  }
  .seats-box {
    // border: 1px solid #000;
    width: calc(100% - 5px - 24px);
    height: 300px;
    padding: 0 12px;
    // display: flex;

    /deep/ .van-icon-success:before {
      content: "";
    }
    .van-checkbox-group {
      border: 1px solid #000;
      display: flex;
      flex-wrap: wrap;
    }
    /deep/ .van-checkbox__icon .van-icon {
      border-radius: 4px;
      margin-bottom: 10px;
      margin-right: 10px;
      &:nth-child(10n){
        border: 1px solid #000;
        margin-right: 0;
      }
    }

    .van-checkbox {
      margin-bottom: 8px;
    }
  }
  .seats-detail {
    margin-top: 14px;
    .van-checkbox-group {
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .sell {
      background-color: #dd403b;
      /deep/ .van-checkbox {
        background-color: #dd403b;
      }
    }
  }
  .card-box {
    // border: 1px solid #000;
    width: calc(100% - 26px);
    // height: 200px;
    background-color: #f0f0f0;
    margin: auto;
    margin-bottom: 10px;
    border-radius: 14px;
    .tip-box {
      height: 40px;
      background-color: #fff6eb;
      // opacity: 0.2;
      border-top-left-radius: 14px;
      border-top-right-radius: 14px;
      padding: 0 14px;
      display: flex;
      align-items: center;
      .tip-img {
        width: 26px;
        height: 26px;
        // border: 1px solid #000;
      }
      .text {
        width: 220px;
        color: #ff950b;
        font-size: 15px;
        margin-left: 6px;
      }
      .right {
        display: flex;
        align-items: center;
        span {
          font-size: 13px;
          color: #ff950b;
        }
        .van-icon-arrow-down {
          margin-left: 2px;
          color: #ff950b;
        }
      }
    }
    .film-box {
      // border: 1px solid #000;
      border-bottom: 1px solid #ddd;
      padding: 10px 14px;
      .filmName {
        font-size: 16px;
        color: #333;
        margin-bottom: 10px;
      }
      .filmDetail {
        font-size: 15px;
        color: #333;
      }
    }
  }
}

.bottom {
  // border: 1px solid #000;
  // background-color: #f5f5f5;
  width: calc(100% - 32px);
  height: 46px;
  position: fixed;
  left: 0;
  bottom: 0;
  padding: 8px 16px;

  .van-button {
    font-size: 16px;
  }
  .price {
    margin-right: 8px;
  }
}
</style>
